<script>
export default {
  data() {
    return {
      show:false,
      permissionList:{},
      requestParam:{
        permissionId:0,
        uri:'',
      }
    }
  },
  methods:{
    /**
     * 用来新增数据时打开
     */
    newOpen(permissionId){
      this.show = true;
      this.requestParam.permissionId = permissionId+"";
    },
    /**
     * 用来修改或查看数据时打开
     */
    open(row){
      this.requestParam = this.$kt.util.deepCopy(row);
      this.show = true;
    },
    close(){
      this.show = false;
    },
    save(){
      // element-plus中的loading
      let loading = this.$loading({
        lock: true,
        text: 'Loading',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.7)'
      });

      this.$kt.request.send({
        uri: "/system-auth/admin/permissionUri/save",
        data: this.requestParam,
        stateSuccess: (res) => {
          this.$message.success(res.message);
          this.$emit("saveSuccess");
          loading.close();
          this.close();
        },
        stateError: (res) => {
          this.$message.error(res.message);
          loading.close();
        }
      });
    }

  }
}
</script>

<template>
<el-dialog v-model="show" width="400px">
  <el-form label-position="top">
    <el-form-item label="URI">
      <el-input v-model="requestParam.uri"></el-input>
    </el-form-item>
    <el-form-item label="">
      <div class="text-right">
        <el-button type="primary" @click="save">
          {{$i18n.enToGlobal("Save")}}
        </el-button>
      </div>
    </el-form-item>
  </el-form>
</el-dialog>
</template>

<style scoped lang="scss">

</style>